public class Solution {
    public boolean isPowerOfFour(int n) {
        if (n <= 0) return false;
        int x = (int)Math.sqrt(n);
        return x * x == n && (x & -x) == x;
    }

    public static void main(String[] args) {
        Solution solution = new Solution();
        int n = 16;
        System.out.println(solution.isPowerOfFour(n));
    }
}
